import { defineStore } from 'pinia'
interface useCommon {
    loading: boolean // 全局loading
}
export const useCommon = defineStore({
    id: "useCommon",

    state: (): useCommon => {
        return {
            loading: false
        }
    },
    // 开启持久化
    persist: {
        enabled: true,
        strategies: [
            {
                key: 'useCommon',  //自定义 Key值
                storage: sessionStorage,  // 选择存储方式
            },
        ],
    },
    actions: {
        loadingStart() {
            this.loading = true
        },
        loadingOver() {
            this.loading = false
        }
    }
})